home *** CD-ROM | disk | FTP | other *** search
- /*
- ARTemis (Graphic Editor for FM-TOWNS)
- (c) MATSUUCHI Ryosuke 1992,1993
-
- copy.c
-
- 「コピー」コマンド
- 「拡大・縮小」コマンド
- */
-
-
- #include <stdio.h>
- #include <malloc.h>
- #include <memory.h>
- #include "ge.h"
- #include "dispman.h"
- #include "imageman.h"
-
-
- #define BLACK_PARA 10
-
-
- static void matte_wordset(short *dp, int col, int op)
- // dp:書き込み先
- {
- int mix = getmixrate();
- if (mode == MODE32K && op == DrawMATTE && blkop_edge)
- {
- int b = coldiff(col, backcol);
- if (b <= BLACK_PARA)
- {
- int c;
- c = colmazeru(*dp, col, (b*256+BLACK_PARA/2)/BLACK_PARA);
- *dp = graycol(*dp,c,mix);
- }
- else
- *dp = graycol(*dp,col,mix);
- }
- else if (op == DrawMATTE)
- {
- if (col != backcol)
- *dp = graycol(*dp,col,mix);
- }
- else if (mix == 256)
- *dp = col;
- else
- *dp = graycol(*dp,col,mix);
- }
-
-
- void matte_hline_map(int x, int x2, int y, char *lbuf, int op)
- {
- char *dp0 = EIMadrs(x,y);
- int mix = getmixrate();
- if (mode == MODE32K && op == DrawMATTE && blkop_edge)
- {
- short *dp,*sp;
-
- void hline(int _x1, int _x2, int _y)
- {
- int i;
- short *dp,*sp;
- dp = (short*)dp0 + _x1 - x;
- sp = (short*)lbuf + _x1 - x;
- for (i=_x1; i<=_x2; i++,sp++,dp++)
- {
- int b = coldiff(*sp, backcol);
- if (b <= BLACK_PARA)
- { int c=colmazeru(*dp,*sp,(b*256+BLACK_PARA/2)/BLACK_PARA);
- *dp = graycol(*dp,c,mix); }
- else
- *dp = graycol(*dp,*sp,mix);
- }
- }
-
- hline_func(x,x2,y, hline);
- }
- else if (op == DrawMATTE)
- {
- void hline(int _x1, int _x2, int _y)
- {
- short *dp = (short*)dp0 + _x1 - x, *sp = (short*)lbuf + _x1 - x;
- for (int i=_x1; i<=_x2; i++,sp++,dp++)
- { if (*sp != backcol) *dp = graycol(*dp,*sp,mix); }
- }
- hline_func(x,x2,y, hline);
- }
- else if (mix == 256)
- {
- void hline(int _x1, int _x2, int _y)
- {
- memcpy(dp0+(_x1-x)*2,lbuf+(_x1-x)*2,(_x2-_x1+1)*2);
- }
- hline_func(x,x2,y, hline);
- }
- else
- {
- void hline(int _x1, int _x2, int _y)
- {
- short *dp = (short*)dp0+_x1-x, *sp = (short*)lbuf+_x1-x;
- for (int i=_x1; i<=_x2; i++,sp++,dp++)
- *dp = graycol(*dp,*sp,mix);
- }
- hline_func(x,x2,y, hline);
- }
- DMimage_hline_map(x,x2,y,dp0);
- }
-
- void matte_putblock(int x,int y,int xlen,int ylen,char *buf,int op)
- {
- int i;
- for (i=0; i<ylen; i++)
- matte_hline_map(x,x+xlen-1,y+i, buf+xlen*2*i, op);
- }
-
- void matte_pset(int x, int y, int col, int op)
- {
- int mix = getmixrate();
- if (mode == MODE32K && op == DrawMATTE && blkop_edge)
- {
- int b = coldiff(col, backcol);
- if (b <= BLACK_PARA)
- {
- int c;
- c = EIMpoint(x,y);
- c = colmazeru(c, col, (b*256+BLACK_PARA/2)/BLACK_PARA);
- EIMgraypset(x,y,c,mix);
- }
- else
- EIMgraypset(x,y,col,mix);
- }
- else if (op == DrawMATTE)
- {
- if (col != backcol)
- EIMgraypset(x,y,col,mix);
- }
- else if (op == DrawNORMAL)
- {
- EIMgraypset(x,y,col,mix);
- }
- else
- EIMpset(x,y,col,op);
- }
-
- /*
- 1ラインの拡大/縮小
- */
-
- static void line_expand(char *outbuf, int outlen, char *inbuf, int inlen)
- {
- int i; int col1,col2; bool col1a,col2a;
- int r,rsx;
- if (outlen <= 1)
- {
- *(short*)outbuf = *(short*)inbuf;
- return;
- }
- r = ((inlen-1) << 16) / (outlen-1);
- rsx = 0;
- col1a = col2a = NO;
- for (i=0; i<outlen; i++,rsx+=r)
- {
- int outcol;
- if ((rsx & 0xff00) == 0)
- {
- if (col2a)
- col1 = col2, col1a = YES, col2a = NO;
- else
- col1 = *(short*)(inbuf+(rsx>>16)*2), col1a = YES;
- outcol = col1;
- }
- else if ((rsx>>16)!=((rsx-r)>>16))
- {
- if (col2a)
- col1 = col2, col1a=YES;
- else
- col1 = *(short*)(inbuf+(rsx>>16)*2), col1a=YES;
- col2 = *(short*)(inbuf+(rsx>>16)*2+2), col2a=YES;
- outcol = colmazeru(col1,col2,(rsx>>8)&0xff);
- }
- else
- {
- if (!col2a)
- col2 = *(short*)(inbuf+(rsx>>16)*2+2), col2a=YES;
- outcol = colmazeru(col1,col2,(rsx>>8)&0xff);
- }
- *(short*)(outbuf + i*2) = outcol;
- }
- }
-
- static void line_shorten(char *outbuf, int outlen, char *inbuf, int inlen)
- {
- int r,rsx;
- int i,sx;
- r = (outlen << 16) / inlen;
- int rgb[3];
- int magsum;
- for (i=0,rsx = 0,sx=0; i<outlen; i++)
- {
- bool end = NO, first = YES;
- rgb[0] = rgb[1] = rgb[2] = 0;
- magsum = 0;
- while (!end)
- {
- int mag, sc = *(short*)(inbuf + sx*2);
- int rsxa = rsx + r;
- if ((rsx & 0xffff0000) == (rsxa & 0xffff0000))
- mag = 256, rsx += r, sx++;
- else if ((rsxa & 0xff00) != 0)
- {
- mag = 256 - ((rsxa & 0xff00) >> 8);
- if (!first)
- end = YES;
- else
- rsx += r, sx++;
- }
- else
- mag = 256, rsx += r, sx++, end = YES;
- rgb[0]+=getR(sc)*mag, rgb[1]+=getG(sc)*mag, rgb[2]+=getB(sc)*mag;
- magsum += mag;
- first = NO;
- }
- int t = magsum/2;
- *(short*)(outbuf+i*2) =
- GRB((rgb[1]+t)/magsum,(rgb[0]+t)/magsum,(rgb[2]+t)/magsum);
- }
- }
-
- static void line_zoom(char *outbuf, int outlen, char *inbuf, int inlen)
- {
- if (outlen == 0 || inlen == 0)
- return;
- if (outlen >= inlen)
- line_expand(outbuf, outlen, inbuf, inlen);
- else
- line_shorten(outbuf, outlen, inbuf, inlen);
- }
-
-
- /*
- ライン単位の処理のためのバッファを生成/消滅する
- */
-
- static char *LINnew()
- {
- return malloc(EIMgetxsize()*2);
- }
-
- static void LINdelete(char *lin)
- {
- free(lin);
- }
-
- /*
- ライン単位の混色のための関数群
- */
-
- typedef char* LMIX;
- // 0~3:バッファの大きさ 4~7:magsum 8~:rgblist
-
- static LMIX LMIXnew()
- {
- char *p; int size;
- size = 4 + 4 + 12 * EIMgetxsize();
- if ((p = malloc(size)) == NULL)
- return p;
- memset(p,0,size);
- *(int*)p = size;
- return (LMIX)p;
- }
-
- static void LMIXdelete(LMIX l)
- {
- free(l);
- }
-
- static void LMIXclear(LMIX l)
- {
- int size = *(int*)l;
- memset((char*)l+4, 0, size-4);
- }
-
- static void LMIXaddline(LMIX l, char *line, int xlen, int mag)
- {
- int *dp = (int*)((char*)l+8);
- short *sp = (short*)line;
- int i;
- for (i=0; i<xlen; i++,sp++)
- {
- int sc = *sp;
- *dp++ += getR(sc)*mag, *dp++ += getG(sc)*mag, *dp++ += getB(sc)*mag;
- }
- *((int*)l+1) += mag;
- }
-
- static void LMIXgetaverage(char *outbuf, int xlen, LMIX l)
- {
- int *sp = (int*)((char*)l+8);
- short *dp = (short*)outbuf;
- int i,magsum,h;
- magsum = *((int*)l+1);
- h = magsum/2;
- for (i=0; i<xlen; i++,dp++,sp+=3)
- *dp = GRB((*(sp+1)+h)/magsum,(*sp+h)/magsum,(*(sp+2)+h)/magsum);
- }
-
-
- static void box_expand( int dx,int dy,int dxlen,int dylen,
- int sx,int sy,int sxlen,int sylen,
- bool matte_sw, bool area_sw )
- {
- char *lbuf1,*lbuf2,*outlbuf;
- LMIX mixbuf;
- if ((lbuf1 = LINnew()) == NULL)
- goto nomem;
- if ((lbuf2 = LINnew()) == NULL)
- { LINdelete(lbuf1); goto nomem; }
- if ((outlbuf = LINnew()) == NULL)
- { LINdelete(lbuf2); LINdelete(lbuf1); goto nomem; }
- if ((mixbuf = LMIXnew()) == NULL)
- { LINdelete(outlbuf); LINdelete(lbuf2); LINdelete(lbuf1); goto nomem; }
- int i; bool col1a,col2a;
- int r,rsy;
- if (dylen <= 1)
- {
- line_zoom(lbuf1,dxlen,EIMadrs_back(sx,sy),sxlen);
- matte_hline_map(dx,dx+dxlen-1,dy,lbuf1,
- (matte_sw ? DrawMATTE:DrawNORMAL));
- }
- else
- {
- r = ((sylen-1) << 16) / (dylen-1);
- rsy = sy << 16;
- col1a = col2a = NO;
- for (i=0; i<dylen; i++,rsy+=r)
- {
- if ((rsy & 0xff00) == 0)
- {
- if (col2a)
- memcpy(lbuf1,lbuf2,dxlen*2), col1a = YES, col2a = NO;
- else
- {
- line_zoom(lbuf1,dxlen,EIMadrs_back(sx,rsy>>16),sxlen);
- col1a = YES;
- }
- memcpy(outlbuf,lbuf1,dxlen*2);
- }
- else if ((rsy>>16)!=((rsy-r)>>16))
- {
- if (col2a)
- memcpy(lbuf1,lbuf2,dxlen*2), col1a=YES;
- else
- {
- line_zoom(lbuf1,dxlen,EIMadrs_back(sx,rsy>>16),sxlen);
- col1a = YES;
- }
- line_zoom(lbuf2,dxlen,EIMadrs_back(sx,(rsy>>16)+1),sxlen);
- col2a=YES;
- LMIXclear(mixbuf);
- LMIXaddline(mixbuf, lbuf1, dxlen, 256-((rsy>>8)&0xff));
- LMIXaddline(mixbuf, lbuf2, dxlen, (rsy>>8)&0xff);
- LMIXgetaverage(outlbuf, dxlen, mixbuf);
- }
- else
- {
- if (!col2a)
- {
- line_zoom(lbuf2,dxlen,EIMadrs_back(sx,(rsy>>16)+1),sxlen);
- col2a=YES;
- }
- LMIXclear(mixbuf);
- LMIXaddline(mixbuf, lbuf1, dxlen, 256-((rsy>>8)&0xff));
- LMIXaddline(mixbuf, lbuf2, dxlen, (rsy>>8)&0xff);
- LMIXgetaverage(outlbuf, dxlen, mixbuf);
- }
- if (!area_sw)
- matte_hline_map(dx,dx+dxlen-1,dy+i,outlbuf,
- (matte_sw ? DrawMATTE:DrawNORMAL));
- else
- {
- char *dp0 = EIMadrs(dx,dy+i);
- int rsx0,r,op;
- rsx0 = sx << 16, r = (sxlen<<16)/dxlen;
- op = (matte_sw ? DrawMATTE:DrawNORMAL);
- void hline(int _x1, int _x2, int _y)
- {
- short *dp = (short*)dp0+_x1-dx;
- int rsx = rsx0 + r * (_x1-dx);
- for (int j=_x1; j<=_x2; j++,rsx+=r,dp++)
- if (area_chkxy(rsx>>16,rsy>>16))
- matte_wordset(dp,*((short*)outlbuf+(j-dx)),op);
- DMimage_hline_map(_x1,_x2,_y,(char*)((short*)dp0+_x1-dx));
- }
- hline_func(dx, dx+dxlen-1, dy+i, hline);
- }
- }
- }
- LMIXdelete(mixbuf);
- LINdelete(outlbuf);
- LINdelete(lbuf2);
- LINdelete(lbuf1);
- return;
- nomem:
- dispAttentionMsg("記憶容量不足のため、拡大/縮小処理が行えません");
- }
-
- static void box_shorten(int dx,int dy,int dxlen,int dylen,
- int sx,int sy,int sxlen,int sylen,
- bool matte_sw, bool area_sw )
- {
- char *lbuf1,*outlbuf;
- LMIX mixbuf;
- if ((lbuf1 = LINnew()) == NULL)
- goto nomem;
- if ((outlbuf = LINnew()) == NULL)
- { LINdelete(lbuf1); goto nomem; }
- if ((mixbuf = LMIXnew()) == NULL)
- { LINdelete(outlbuf); LINdelete(lbuf1); goto nomem; }
- int r,rsy;
- int i,bufy,sy0=sy;
- if (sylen == 0)
- return;
- r = (dylen << 16) / sylen;
- bufy = -1;
- for (i=0,rsy=sy<<16; i<dylen; i++)
- {
- bool end = NO, first = YES;
- LMIXclear(mixbuf);
- while (!end)
- {
- int mag;
- if (sy != bufy)
- {
- line_zoom(lbuf1,dxlen,EIMadrs_back(sx,sy),sxlen);
- bufy = sy;
- }
- int rsya = rsy + r;
- if ((rsy & 0xffff0000) == (rsya & 0xffff0000))
- mag = 256, rsy += r, sy++;
- else if ((rsya & 0xff00) != 0)
- {
- mag = 256 - ((rsya & 0xff00) >> 8);
- if (!first)
- end = YES;
- else
- rsy += r, sy++;
- }
- else
- mag = 256, rsy += r, sy++, end = YES;
- LMIXaddline(mixbuf, lbuf1, dxlen, mag);
- first = NO;
- }
- LMIXgetaverage(outlbuf, dxlen, mixbuf);
- if (!area_sw)
- {
- matte_hline_map(dx,dx+dxlen-1,dy+i,outlbuf,
- (matte_sw ? DrawMATTE:DrawNORMAL));
- }
- else
- {
- char *dp0 = EIMadrs(dx,dy+i);
- int rsx0,r,op;
- rsx0 = sx << 16, r = (sxlen<<16)/dxlen;
- op = (matte_sw ? DrawMATTE:DrawNORMAL);
- int _sy,h=(dylen-1)/2;
- _sy = sy0 + (dylen <= 1 ? 0 : ((sylen-1)*i+h)/(dylen-1));
- void hline(int _x1, int _x2, int _y)
- {
- short *dp = (short*)dp0 + _x1-dx;
- int rsx = rsx0 + r * (_x1-dx);
- for (int j=_x1; j<=_x2; j++,rsx+=r,dp++)
- if (area_chkxy(rsx>>16,_sy))
- matte_wordset(dp,*((short*)outlbuf+j-dx),op);
- DMimage_hline_map(_x1,_x2,_y,(char*)((short*)dp0+_x1-dx));
- }
- hline_func(dx,dx+dxlen-1,dy+i,hline);
- }
- }
- LMIXdelete(mixbuf);
- LINdelete(outlbuf);
- LINdelete(lbuf1);
- return;
- nomem:
- dispAttentionMsg("記憶容量不足のため、拡大/縮小処理が行えません");
- }
-
-
-
-
- void zoomcopy(int sx1, int sy1, int sx2, int sy2,
- int dx1, int dy1, int dx2, int dy2,
- bool matte_sw, bool area_sw)
- // matte_sw : 半透明指定を有効化するスイッチ(通常 ON, view時 OFF)
- // area_sw : 領域指定を有効化するスイッチ
- {
- // 縮小処理
- // 8ビット固定小数で計算
- #define _swap(a,b) { int t; t=(a); (a)=(b); (b)=t; }
- if (sx2 < sx1)
- _swap(sx1,sx2);
- if (sy2 < sy1)
- _swap(sy1,sy2);
- if (dx2 < dx1)
- _swap(dx1,dx2);
- if (dy2 < dy1)
- _swap(dy1,dy2);
- int sxl,syl,dxl,dyl;
- sxl = sx2-sx1+1;
- syl = sy2-sy1+1;
- dxl = dx2-dx1+1;
- dyl = dy2-dy1+1;
- int x,y;
- if (mode == MODE32K)
- {
- if (dyl < syl)
- box_shorten(dx1,dy1,dxl,dyl, sx1,sy1,sxl,syl, matte_sw, area_sw);
- else
- box_expand(dx1,dy1,dxl,dyl, sx1,sy1,sxl,syl, matte_sw, area_sw);
- }
- else // 16色モード
- {
- #if NO16==0
- for (y=dy1; y<=dy2; y++)
- {
- for (x=dx1; x<=dx2; x++)
- {
- int sx,sy;
- if (dxl <= 1)
- sx = sx1;
- else
- sx = sx1+(x-dx1)*(sxl-1)/(dxl-1);
- if (dyl <= 1)
- sy = sy1;
- else
- sy = sy1+(y-dy1)*(syl-1)/(dyl-1);
- int c;
- c = EIMpoint_back(sx,sy);
- EIMpset(x,y,c,blkop);
- }
- }
- #endif
- }
- }
-
-
-
-
- static void commandZoom_sub(int method)
- {
- for(;;)
- {
- if (area_input(method) != 0)
- break;
- int ax1,ay1,ax2,ay2;
- area_getboundxy(&ax1,&ay1,&ax2,&ay2);
- int step = 0; // 0:転送先始点指定中 1:転送先終点指定中
- int dx1=0,dy1=0;
- void drawcsr(int msx,int msy)
- {
- MOFF;
- int tx=DMimage_getx(msx), ty=DMimage_gety(msy);
- if (step==1)
- {
- int xr=ax2-ax1,yr=ay2-ay1;
- if (xr>0 && yr>0)
- {
- if (xr>yr)
- {
- int r = (yr<<16) / xr;
- int xmax = EIMgetxsize()-1;
- int y1 = (r * dx1)>>16, y2 = (r * (xmax-dx1))>>16;
- EIMline(0,dy1-y1,xmax,dy1+y2,white,DrawXOR);
- EIMline(0,dy1+y1,xmax,dy1-y2,white,DrawXOR);
- }
- else
- {
- int r = (xr<<16) / yr;
- int ymax = EIMgetysize()-1;
- int x1 = (r * dy1)>>16, x2 = (r * (ymax-dy1))>>16;
- EIMline(dx1-x1,0,dx1+x2,ymax,white,DrawXOR);
- EIMline(dx1+x1,0,dx1-x2,ymax,white,DrawXOR);
- }
- }
- EIMboxline(dx1,dy1,tx,ty,white,DrawXOR);
- }
- MON;
- }
- area_drawbound();
- for (;;)
- {
- int prex,prey;
- if (step == 0)
- DMdispcsr(ms.x,ms.y);
- drawcsr((prex=ms.x),(prey=ms.y));
- do {
- ms_get(&ms);
- } while (ms.dx==0 && ms.dy==0 && ms.btn1==OFF && ms.btn2==OFF &&
- key_chk() == 0);
- if (step == 0)
- DMerasecsr();
- drawcsr(prex,prey); // 消去
- scrollForCsr(1,1);
- if (ms.btn1 == OFFON)
- {
- if (step == 0)
- {
- step=1;
- dx1=DMimage_getx(ms.x), dy1=DMimage_gety(ms.y);
- }
- else
- {
- int dx2,dy2;
- dx2=DMimage_getx(ms.x),dy2=DMimage_gety(ms.y);
- area_drawbound();
- EIMbackup();
- zoomcopy(ax1,ay1,ax2,ay2, dx1,dy1,dx2,dy2,
- (blkop==DrawMATTE?YES:NO),YES);
- area_drawbound();
- step = 0;
- }
- }
- if (ms.btn2 == OFFON)
- {
- if (step == 0)
- break;
- else
- step = 0;
- }
- }
- area_drawbound();
- }
- }
-
- void commandZoom()
- {
- commandZoom_sub(AREA_BOX);
- }
-
- void commandZoomPoly()
- {
- commandZoom_sub(AREA_POLYGON);
- }
-
-
- static int coldiff(int col1, int col2)
- // col1,col2 : 3万色カラーコード
- // 返値 : col1 と col2 の違い
- {
- int r;
- r = _abs((col1 & 31) - (col2 & 31));
- r += _abs(((col1 >> 5) & 31) - ((col2 >> 5) & 31));
- r += _abs(((col1 >> 10) & 31) - ((col2 >> 10) & 31));
- return r;
- }
-
-
- static int colmazeru(int c1, int c2, int pow)
- // pow : 混色率 0..256
- {
- short int g,r,b;
- short int p1,p2;
- if (pow == 0)
- return c1;
- else if (pow == 256)
- return c2;
- p1 = 256-pow;
- p2 = pow;
- g = (((c1>>10)&31)*p1+((c2 >> 10) & 31)*p2+128)/256;
- r = (((c1 >> 5) & 31)*p1+((c2 >> 5) & 31)*p2+128)/256;
- b = ((c1 & 31)*p1+(c2 & 31)*p2+128)/256;
- return (int)((g<<10)+(r<<5)+b);
- }
-
-
-
- #define HTURN 1
- #define VTURN 2
-
- static void commandCopyPoly_sub(int method,int turn)
- {
- int lat2xlen,lat2ylen;
- DMimage_getlatticesize(&lat2xlen,&lat2ylen);
- for(;;)
- {
- if (area_input(method) != 0)
- break;
- int ax1,ay1,ax2,ay2;
- area_getboundxy(&ax1,&ay1,&ax2,&ay2);
- void drawcsr(int msx,int msy)
- {
- MOFF;
- int tx=DMimage_getx(msx), ty=DMimage_gety(msy);
- if (areaadj && method == AREA_BOX)
- tx = tx - tx % lat2xlen, ty = ty - ty % lat2ylen;
- EIMrboxline(tx,ty,ax2-ax1+1,ay2-ay1+1,white,DrawXOR);
- MON;
- }
- area_drawbound(); // 転送元ボックス表示
- int zr = DMimage_getzoomrate();
- scrollForCsr((ax2-ax1+1)*zr,(ay2-ay1+1)*zr);
- for (;;)
- {
- int prex,prey;
- if (method == AREA_BOX && areaadj)
- DMdispcsr(ms.x,ms.y);
- drawcsr((prex=ms.x),(prey=ms.y));
- do {
- ms_get(&ms);
- } while (ms.dx==0 && ms.dy==0 && ms.btn1==OFF && ms.btn2==OFF &&
- key_chk() == 0);
- if (method == AREA_BOX && areaadj)
- DMerasecsr();
- drawcsr(prex,prey); // 消去
- scrollForCsr((ax2-ax1+1)*zr,(ay2-ay1+1)*zr);
- // scrollForCsr(1,1);
- if (ms.btn1 == OFFON)
- {
- area_drawbound(); // 転送元ボックス消去
- EIMbackup();
- int dx,dy;
- dx = DMimage_getx(ms.x), dy = DMimage_gety(ms.y);
- if (areaadj && method == AREA_BOX)
- dx = dx - dx % lat2xlen, dy = dy - dy % lat2ylen;
- int x,y;
- char *lbuf = LINnew();
- if(lbuf == NULL)
- goto _endturn;
- for (y=ay1; y<=ay2; y++)
- {
- x = ax1 + area_chkxylen(ax1,ax2,y,YES);
- while (x<=ax2)
- {
- int l;
- if ((l = area_chkxylen(x,ax2,y,NO)) == 0)
- break;
- if (turn == 0)
- {
- matte_hline_map(dx+(x-ax1),dx+(x+l-1-ax1),
- dy+(y-ay1),EIMadrs_back(x,y),
- blkop);
- }
- else if (turn & VTURN)
- {
- matte_hline_map(dx+(x-ax1),dx+(x+l-1-ax1),
- dy+(ay2-y),EIMadrs_back(x,y),
- blkop);
- }
- else if (turn & HTURN)
- {
- memcpy(lbuf,EIMadrs_back(x,y),l*2);
- int i,t;
- for (i=0; i<l/2; i++)
- {
- #define SA(a,i) *((short*)(a)+(i))
- t = SA(lbuf,i);
- SA(lbuf,i)=SA(lbuf,l-1-i);
- SA(lbuf,l-1-i)=t;
- #undef SA
- }
- matte_hline_map(dx+(ax2-(x+l-1)),dx+(ax2-x),
- dy+(y-ay1), lbuf,blkop);
- }
- x += l + area_chkxylen(x+l,ax2,y,YES);
- }
- }
- LINdelete(lbuf);
- _endturn:
- area_drawbound(); // 転送元ボックス表示
- }
- if (ms.btn2 == OFFON)
- break;
- }
- area_drawbound(); // 転送元ボックス消去
- }
- }
-
- void commandCopyPoly()
- {
- commandCopyPoly_sub(AREA_POLYGON, 0);
- }
-
-
- void commandCopy()
- {
- commandCopyPoly_sub(AREA_BOX,0);
- }
-
-
- void commandCopyPolyHturn()
- {
- commandCopyPoly_sub(AREA_POLYGON, HTURN);
- }
-
- void commandCopyPolyVturn()
- {
- commandCopyPoly_sub(AREA_POLYGON, VTURN);
- }
-
- void commandCopyHturn()
- {
- commandCopyPoly_sub(AREA_BOX,HTURN);
- }
-
- void commandCopyVturn()
- {
- commandCopyPoly_sub(AREA_BOX,VTURN);
- }
-
-
- /* end of copy.c */
-
-